﻿@model IEnumerable<Package>
@{
    Layout = "~/Views/Shared/_Dashboard.cshtml";
}

@UIHelper.ImageTitle(Html.Global("RES_DEPLOY"),@Html.Global("Deploy_Desc"),"~/content/images/icon_gears_48.png")

<p>
    @Ajax.Dna().Link(Html.Global("RES_HELP"), Url.Help(9), Url.Content("~/content/images/help.png")).Options(opts => { opts.Target = "_blank"; }).GetHtml()
</p>

@UIHelper.SectionHeader(Html.Global("Deploy_Upload_Package"))
<form method="post" enctype="multipart/form-data" action="@Url.Action("Index", "Deploy")" style="padding:20px;">
@if (ViewBag.Error != null)
{ 
    <p class="ui-state-error" style="padding:20px;">
    @ViewBag.Error
    </p>
}
<p>@Html.Global("Deploy_Upload_Package_Tips")</p>
<p>
    <input type="file" name="PackageFile" /><span>&nbsp;&nbsp;
   @Html.Global("Deploy_Upload_File_Tips") </span></p>
<p>
    @Ajax.Dna().Button().ChangeType(ButtonTypes.ImageButton).Images(Url.Content("~/content/images/img_button_upload.jpg"), Url.Content("~/content/images/img_button_upload_hover.jpg")).Submit().GetHtml()
</p>
</form>

@UIHelper.SectionHeader(@Html.Global("Deploy_Wait_For_Deploy"))
@foreach (var pkg in Model)
{
    if (pkg != null)
    {
    <table>
        <tr>
            <td style="width: 200px; vertical-align: top; text-align: center;">
                @{var _img = pkg.Images.FirstOrDefault();}
                @if (_img != null)
                {
                    <img src="@pkg.ResolveUrl(_img.Url)" alt="@pkg.Title" />
                }
                else
                {
                   <img src="@Url.Content("~/content/images/img_package_nopreview.png")" alt="nopreview" />
                }
                <div>
                    @Ajax.Dna().Button().LocText("RES_INSTALL").Click("location=\"" + Url.Action("Verify", "Deploy", new { name = pkg.Name }) + "\"").GetHtml()
                    @Ajax.Dna().Button().LocText("RES_REMOVE").ImageIcons(Url.Content("~/content/images/icon_delete_16.png")).Click("location=\"" + Url.Action("Remove", "Deploy", new { name = pkg.Name }) + "\"").GetHtml()
                </div>
            </td>
            <td style="vertical-align: top;">
                @UIHelper.PackageInfo(pkg)
            </td>
        </tr>
    </table>
    <hr />
    }
}